package com.yuezhi.acl.security.handler;

import com.yuezhi.utils.MD5;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Component;

@Component
public class MyPasswordEncoder implements PasswordEncoder {

    @Override
    public String encode(CharSequence charSequence) {
        return MD5.encrypt(charSequence.toString());
    }

    @Override
    public boolean matches(CharSequence charSequence, String s) {
        System.out.println("测试:密码对比---"+s.equals(MD5.encrypt(charSequence.toString())));
        return s.equals(MD5.encrypt(charSequence.toString()));
    }
}
